package cn.cy.behavior.chain.pattern;

/**
 * @author yangxq
 * @desc
 * @date 2025-05-09
 */
public class PatternClient {

    public static void main(String[] args) {
        Handler userHandler = new UserHandler();
        Handler adminHandler = new AdminHandler();
        Handler superAdminHandler = new SuperAdminHandler();

        userHandler.setNext(adminHandler);
        adminHandler.setNext(superAdminHandler);

        userHandler.handleRequest(new Request("USER"));        // 输出: 普通用户处理请求
        userHandler.handleRequest(new Request("ADMIN"));       // 输出: 管理员处理请求
        userHandler.handleRequest(new Request("SUPER_ADMIN"));  // 输出: 超级管理员处理请求
        userHandler.handleRequest(new Request("UNKNOWN"));      // 输出: (无输出)
    }

}
